package com.liao.intimacy;

import com.liao.kv.base.BaseDimension;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class RankDimension extends BaseDimension {

    //数据库主键
    private int id;
    //亲密度排行
    private int rank;
    //联系人维度1
    private int telephone1;
    //联系人维度2
    private int telephone2;
    //通话次数
    private int call_times;
    //通话时长
    private int duration;

    public RankDimension(){
        super();
    }

    public RankDimension(int id, int rank, int telephone1, int telephone2, int call_time, int duration) {
        super();
        this.rank = rank;
        this.telephone1 = telephone1;
        this.telephone2 = telephone2;
        this.call_times = call_time;
        this.duration = duration;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getRank() {
        return rank;
    }

    public void setRank(int rank) {
        this.rank = rank;
    }

    public int getTelephone1() {
        return telephone1;
    }

    public void setTelephone1(int telephone1) {
        this.telephone1 = telephone1;
    }

    public int getTelephone2() {
        return telephone2;
    }

    public void setTelephone2(int telephone2) {
        this.telephone2 = telephone2;
    }

    public int getCall_time() {
        return call_times;
    }

    public void setCall_time(int call_time) {
        this.call_times = call_time;
    }

    public int getDuration() {
        return duration;
    }

    public void setDuration(int duration) {
        this.duration = duration;
    }

    @Override
    public int compareTo(BaseDimension o) {
        return 0;
    }

    @Override
    public void write(DataOutput out) throws IOException {
        out.writeUTF(String.valueOf(rank));
        out.writeUTF(String.valueOf(telephone1));
        out.writeUTF(String.valueOf(telephone2));
        out.writeUTF(String.valueOf(call_times));
        out.writeUTF(String.valueOf(duration));
    }

    @Override
    public void readFields(DataInput in) throws IOException {
        this.rank = Integer.parseInt(in.readUTF());
        this.telephone1=Integer.parseInt(in.readUTF());
        this.telephone2=Integer.parseInt(in.readUTF());
        this.call_times=Integer.parseInt(in.readUTF());
        this.duration =Integer.parseInt(in.readUTF());
    }

    @Override
    public String toString() {
        return "RankDimension{" +
                "id=" + id +
                ", rank=" + rank +
                ", telephone1=" + telephone1 +
                ", telephone2=" + telephone2 +
                ", call_times=" + call_times +
                ", duration=" + duration +
                '}';
    }
}
